package org.lifei;

import org.lifei.auth.interceptors.AuthInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("org.lifei.*.mapper")
@ServletComponentScan("org.lifei.base.listener")//组件扫描 扫描监听器
public class PlatformAppStarter implements WebMvcConfigurer {
    @Autowired
    private AuthInterceptor authInterceptor;

    public static void main(String[] args) {
        //args  不接受外部的指定参数
        SpringApplication.run(PlatformAppStarter.class,args);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login","/loginOut");
    }
}
